//
//  YLPasswordResetViewController.m
//  YLHelper
//
//  Created by she1323 on 2018/5/17.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "YLPasswordResetViewController.h"

@interface YLPasswordResetViewController ()
@property (weak, nonatomic) IBOutlet UIView *topView;
@property (weak, nonatomic) IBOutlet UIView *bottomView;
@property (weak, nonatomic) IBOutlet UIButton *sureBtn;
@property (weak, nonatomic) IBOutlet UITextField *topTf;
@property (weak, nonatomic) IBOutlet UITextField *bottomTf;

@end

@implementation YLPasswordResetViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setCorder:self.topView];
    [self setCorder:self.bottomView];
    [self setCorder:self.sureBtn];
    // Do any additional setup after loading the view from its nib.
}
-(void)setNavgationBackBtn{
    [super setNavgationBackBtn];
    self.navigationItem.title = @"重置密码";
    self.view.backgroundColor = [UIColor whiteColor];
}
-(void)setCorder:(UIView *)view{
    view.layer.cornerRadius = 23;
    view.layer.masksToBounds = YES;
    if ([view isKindOfClass:[UIButton class]]) {
        return;
    }
    view.layer.borderWidth = 1;
    view.layer.borderColor = COLOR_HEX(0xE0E0E0).CGColor;
}
- (IBAction)confirmChangeAction:(id)sender {
    if ([NSString isBlankString:self.topTf.text]) {
        [SVProgressHUD showInfoWithStatus:@"请输入新密码"];
        return;
    }
    if ([NSString isBlankString:self.bottomTf.text]) {
        [SVProgressHUD showInfoWithStatus:@"请输入新密码"];
        return;
    }
    if (![self.topTf.text isEqual:self.bottomTf.text]) {
        [SVProgressHUD showInfoWithStatus:@"两次输入的密码不一致"];
        return;
    }
    NSDictionary *param = [NSDictionary dictionaryWithObjectsAndKeys:self.telCode,@"TelCode",self.bottomTf.text,@"UpPassword",self.vericode,@"VerificationCode", nil];
    [[LKNetDataManager defaultManager] sendRequestMethod:HTTPMethodPOST serverUrl:ServerlUrl apiPath:changePassword header:[LKUserInforTool header] parameters:param progress:^(NSProgress * _Nullable progress) {
        
    } success:^(BOOL isSuccess, id  _Nullable responseObject) {
        [SVProgressHUD showInfoWithStatus:@"修改成功"];
        [self dismissViewControllerAnimated:YES completion:nil];
    } failure:^(NSString * _Nullable errorMessage) {
        
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
